<template>
  <van-tabbar  v-show="$route.name != 'details'  ">
    <van-tabbar-item
      v-for="item in menus"
      :key="item.name"
      :name="item.name"
      :icon="item.icon"
      :info="item.info"
      @click="change(item.name)"
    >{{item.tex}}</van-tabbar-item>
  </van-tabbar>
</template>
<script>
export default {
  data() {
    return {
      menus: [
        {
          name: "home",
          icon: "wap-home-o",
          tex: "首页",
          info: ""
        },
        {
          name: "list",
          icon: "apps-o",
          tex: "商品列表",
          info: ""
        },
        {
          name: "cart",
          icon: "shopping-cart-o",
          tex: "购物车",
          info: this.$store.getters.total
        },
        {
          name: "mine",
          icon: "contact",
          tex: "个人中心",
          info: ""
        }
      ]
    };
  },
  // computed: {
  //   totalNum() {
  //     // window.console.log("购物车总数量");
  //     return this.num= this.$store.getters.total;
  //   }
  // },
  methods: {
    change(name) {
      this.$router.push({ name });
    }
  }
};
</script>